home *** CD-ROM | disk | FTP | other *** search
/ A.C.E. 2 / ACE CD 2.iso / FILES / UTILS / HSBASIC2.DMS / in.adf / HB2Examples2.0.Lha / Examples / HBMsg / Compile.ttx < prev    next >
Encoding:
Text File  |  1994-05-10  |  1.2 KB  |  58 lines

  1. /**
  2.  * $Id: Compile.ttx,v 1.1 1994/05/10 13:03:53 alex Rel $
  3.  *
  4.  * REXX script to call HBC from TurboText
  5.  *
  6.  * (c) Copyright 1994 HiSoft
  7. **/
  8.  
  9. Options RESULTS
  10.  
  11. 'GetFilePath'
  12. FROM = RESULT
  13.  
  14. FILE = ParseFileName(FROM, 'FILE')
  15. PATH = ParseFileName(FROM, 'PATH')
  16.  
  17. ERRPFNAME = 'PIPE:' || FILE || '.0'
  18.  
  19. Address 'COMMAND'
  20. 'Run CD ' || PATH,
  21.   || ' +' || '0A'X || 'HBC' '>' ERRPFNAME FILE 'BATCH WITH HBasic2:HBC.Opts'
  22.  
  23. Address 'HBMSG'
  24.  
  25. check = open('errpipe', ERRPFNAME, 'READ')
  26.  
  27. do while ~eof('errpipe')
  28.     srcln = readln('errpipe')
  29.     say srcln
  30.     parse var srcln ERRCLASS ':'
  31.     if ERRCLASS = 'Error' | ERRCLASS = 'Warning' then do
  32.         parse var srcln ERRCLASS ':' ERRCODE ERRMSG ' at line ' ERRLINE ' in file ' ERRFILE
  33.         if ERRFILE = FILE then
  34.             ERRFILE = FROM
  35.         'NewMsg' '"' || ERRFILE || '"',
  36.           '"' || ERRFILE || '"',
  37.           ERRLINE '0',
  38.           '"" 0',
  39.           ERRCLASS,
  40.           ERRCODE,
  41.           '"' || strip(ERRMSG, B) || '"'
  42.     end
  43. end
  44. address COMMAND
  45. 'Ask >NIL: ""'
  46.  
  47. exit 0
  48.  
  49. /* Split filename from path */
  50. ParseFileName: procedure
  51.     parse arg FilePath, Part
  52.  
  53.     DivPos = max(lastpos(':', FilePath),lastpos('/', FilePath)) +1
  54.     if abbrev('FILE', upper(Part)) then
  55.         return substr(FilePath, DivPos)
  56.     else
  57.         return strip(left(FilePath, DivPos-1),'T', '/')
  58.